public class SolutionOffer11 {
    public int minArray(int[] numbers) {
        int l=0,r=numbers.length-1;
        while (l<r){
            int mid=(l+r)/2;
            if (numbers[mid]>numbers[r]){
                l=mid+1;
            }else if (numbers[mid]<numbers[r]){
                r=mid;
            }else{
                r--;
            }
        }
        return numbers[l];
    }

    public static void main(String[] args) {
        System.out.println(new SolutionOffer11().minArray(new int[]{3,4,5,1,2}));
    }
}
